<?
/* @author Udo Schroeter <udo.schroeter@gmail.com>
 * @license dual license: LGPL / commercial use license
 */ 

class TalkController extends AGController
{
  // fixme: there is no check whether a character is even allowed to do a specific action
  // it currently relies on the id parameter only!!!
  
  function __construct($ctrName) 
  {
    parent::__construct($ctrName);
    $this->invokeModel();
    $this->game = $this->getModel('game');
    $this->_initContext();
  }

  function _initContext()
  {
    $this->selectedAction = $_REQUEST['id']+0;
    $this->model->character = &$this->character;
    $this->model->parent = &$this;
    $this->game->loadZone($this->character->charDS['c_location']);
    $this->game->loadAction($this->selectedAction);
    $this->model->loadTalkFromActionDS($this->game->act, $_REQUEST['tp']);
  }

  function Index()
  {
    $this->pageTitle = getDefault($this->game->act['a_name'], 'Conversation');
    if ($_REQUEST['tp'] == 'cancel')
      $this->redirect('index', 'game');    
  }
  
  function Ajax_Log()
  {
    global $config;
    $config['site.pagetemplate'] = 'blank';
    $this->model->loadCurrentOptions();
  }
  
}

?>